﻿<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Pragma" content="no-cache">
<link rel="STYLESHEET" type="text/css" id="SkinStyleSheet">
<title>WebNoteEditor</title>
<style type="text/css">
body{
	margin:5px;background:white
}
</style>
<script language="javascript" type="text/javascript" src="../script/windialog.js"></script>
<script language="javascript" type="text/javascript" src="../script/ie2w3c-min.js"></script>

<script language="javascript" type="text/javascript">
window.onload=function()
{
	renderWindowAsIE(window);
	var filepath=EditorWindow.getUrlArgment("file",document);

	filepath=unescape(filepath);
	document.getElementById("filepath").innerText=filepath;
	document.getElementById("file1").focus();
	document.getElementById("file1").onpaste=file1_onpaste;
	document.getElementById("file1").onfocus=__file1_onfocus;
	window.clipboardData.setData("Text",filepath);
	
	document.getElementById("ImgToUpload").src=filepath;
	document.getElementById("ImgToUpload").style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=scale,src='"+document.getElementById("ImgToUpload").src+"')";
}


function file1_onpaste()
{
	window.setTimeout("UploadIt()",300);
}

function UploadIt()
{
	if (document.getElementById("file1").value!="")
	{
		var ext=EditorWindow.getFileExt(document.getElementById("filepath").innerText);

		if (document.getElementById("filepath").innerText==document.getElementById("file1").value)
		{
			if (EditorWindow.$config.allow_upload_image_ext.isInArray(ext))
			{
				window.top.CaculateProg()
				window.top.UpLoadStatus.innerText=EditorWindow.lang_uploading_file
				document.getElementById("form0").submit()
			}
			else
			{
				alert(EditorWindow.lang_error_upload_unknowfile);
			}
		}
		else
		{
			if (confirm(EditorWindow.lang_tips105))
			{
				if (EditorWindow.$config.allow_upload_image_ext.isInArray(ext))
				{
					window.top.CaculateProg();
					window.top.document.getElementById("UpLoadStatus").innerText=EditorWindow.lang_uploading_file;
					document.getElementById("form0").submit();
				}
				else
				{
					alert(EditorWindow.lang_error_upload_unknowfile);
				}
			}

		}
	}
	else
	{
		alert(EditorWindow.lang_select_uploadfile);
	}
}

function __file1_onfocus()
{
	if (document.getElementById("file1").value!="")
	{
		var ext=EditorWindow.getFileExt(document.getElementById("file1").value);
		if (EditorWindow.$config.allow_upload_image_ext.isInArray(ext))
		{
			document.getElementById("ImgObject").src=document.getElementById("file1").value;
			document.getElementById("ImgObject").style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=scale,src='"+document.getElementById("file1").value+"')";
		}
	}
}
</script>

</head>

<body>
<div id="filepath"></div>

<script language="javascript">
	document.write("<form id=\"form0\" method=\"post\" action=\"../"+EditorWindow.$config.isapi+"/mt_uploadfileprocess."+EditorWindow.$config.isapi+"\" target=\"_self\" enctype=\"multipart/form-data\">");
	document.write("<input type=\"file\" id=\"file1\" name=\"file1\" style=\"width:100%\"></form>");
</script>

<table border="0" width="100%" align="center">
  <tr>
    <td width="150"><script language="javascript" type="text/javascript">dialogPrintlang("lang_upload_image_original");</script></td>
    <td width="150"><script language="javascript" type="text/javascript">dialogPrintlang("lang_upload_image_select");</script></td>
  </tr>
  <tr>
    <td width="150"><a href="" target="_blank"><img id="ImgToUpload" src="" alt="" width=150 height=150 border=0></a></td>
    <td width="150"><a href="" name="ViewImgSrc" target="_blank"><img id="ImgObject" src="" alt="" width=150 height=150 border=0></a></td>
  </tr>
</table>
</body>

</html>
